//
//  IManager+ModuleSearchCityCategory.m
//  RocketProject
//
//  Created by Wu Chengwei on 13-7-8.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+ModuleSearchCityCategory.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "FrameworkRelativeDefines.h"
#import "RCSearchAllCityDataModel.h"

@implementation IManager(ModuleSearchCityCategory)

-(int64_t)requestSearchCityCategory:(NSString *)cityid  withDelegate:(id<IManagerDelegate>)delegate
{
    if (nil == cityid) {
        return kInvalidRequestId;
    }
    // 异步获取数据
    NSString *urlSuffix = [NSString stringWithFormat:kRCCityCateforyUrlPrefix,cityid];
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCSearchCategoryListDataModel class]
                                                     withDataDelegate:delegate];
}

-(int64_t)requestSearchCityDistrict:(NSString *)cityid  withDelegate:(id<IManagerDelegate>)delegate
{
    if (nil == cityid) {
        return kInvalidRequestId;
    }
    // 异步获取数据
    NSString *urlSuffix = [NSString stringWithFormat:kRCCityDistrictUrlPrefix,cityid];
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCSearchDistrictListDataModel class]
                                                     withDataDelegate:delegate];
}

@end
